<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="UTF-8">
    <title>评论情感分析</title>
    <!-- 引入 Chart.js 库和插件 -->
    <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/chartjs-plugin-datalabels"></script>
	<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
    <style>
        /* 保留原有的样式 */





        .navbar {
            display: flex;
            background-color: #c0392b;
            align-items: center;
            padding: 10px;
        }

        .navbar a {
            color: #fff;
            padding: 14px 20px;
            text-decoration: none;
            text-align: center;
        }

        .navbar a:hover {
            background-color: #ddd;
            color: black;
        }

        .logo-container {
            display: flex;
            align-items: center;
            margin-right: auto;
        }
        #commentsTable {
            width: 100%;
            border-collapse: collapse;
            margin: 20px 0;
        }

        #commentsTable th, #commentsTable td {
            border: 1px solid #ddd;
            padding: 8px;
        }

        #commentsTable th {
            background-color: #f2f2f2;
            text-align: left;
        }
        .logo-container img {
            height: 40px;
            margin-right: 10px;
        }

        .logo-container span {
            color: #fff;
            font-size: 24px;
        }

        .dropdown {
            position: relative;
            display: inline-block;
        }

        .dropdown-content {
            display: none;
            position: absolute;
            background-color: #f9f9f9;
            min-width: 160px;
            z-index: 1;
        }

        .dropdown-content a {
            color: black;
            padding: 12px 16px;
            text-decoration: none;
            display: block;
        }

        .dropdown-content a:hover {
            background-color: #f1f1f1;
        }

        .dropdown:hover .dropdown-content {
            display: block;
        }

        .dropdown:hover .dropbtn {
            background-color: #ddd;
            color: black;
        }

        body {
            font-family: "微软雅黑", Arial, sans-serif;
            background-color: #f8e9e9;
            color: #333;
            margin: 0;
            padding: 0;
        }

        header {
            background-color: #f8e9e9;
            padding: 20px;
            text-align: center;
            color: white;
        }

        header h1 {
            margin: 0;
            font-size: 36px;
            color: #c0392b;
        }

        header h2 {
            margin: 5px 0 0 0;
            font-size: 18px;
            font-weight: normal;
            color: #c0392b;
        }

        main {
            max-width: 1500px;
    margin: 20px auto;
    padding: 0 20px;
    display: grid;
    grid-template-rows: 650px auto;
    grid-template-columns: 400px auto  400px; /* 假设左右侧边栏各200px宽，中间自适应 */
    grid-template-areas:
        "left chart right"
        "normal normal normal";
        }
        .left-sidebar {
    grid-area: left;
    background-color: #f8e9e9;
    padding: 10px;
    box-shadow: 0 4px 8px rgba(192, 57, 43, 0.2);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.right-sidebar {
    grid-area: right;
    background-color: #f8e9e9;
    padding: 10px;
    box-shadow: 0 4px 8px rgba(192, 57, 43, 0.2);
    display: flex;
    flex-direction: column;
    align-items: center;
}

        .chart-container {
            grid-area: chart;
    background-color: white;
    padding: 20px;
    margin-bottom: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(192, 57, 43, 0.2);
    height: 600px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
        }

        .chart-container canvas {
            width: 100% !important;
            height: 400px !important;
        }

        table {
                grid-area: normal;
        width: 100%;
        border-collapse: collapse;
        margin-top: 20px;
        background-color: white;
        border-radius: 8px;
        overflow: hidden;
            }

        th, td {
            padding: 15px;
            text-align: center;
            border-bottom: 1px solid #f2f2f2;
            color: #333;
            min-width: 100px;
        }

        th {
            background-color: #c0392b;
            color: white;
            font-weight: bold;
        }

        tr:hover td {
            background-color: #fbeeea;
            border-radius: 5px;
            transition: background-color 0.2s, border-radius 0.2s;
        }

        .pagination {
            grid-area: normal;
    display: flex;
    justify-content: center;
    align-items: flex-end;
	margin-bottom: -5%;
        }

        .pagination button {
            background-color: #c0392b;
            color: white;
            border: none;
            padding: 10px 15px;
            font-size: 14px;
            border-radius: 5px;
            cursor: pointer;
            transition: background-color 0.3s;
            margin: 0 5px;
        }

        .pagination button:hover {
            background-color: #a93226;
        }

        .pagination button:disabled {
            background-color: #d98880;
            cursor: not-allowed;
        }

        .pagination input {
            text-align: center;
            padding: 10px;
            font-size: 14px;
            border: 1px solid #ccc;
            border-radius: 5px;
            transition: border-color 0.3s;
            margin-left: 10px;
            width: 60px;
        }

        .pagination input:focus {
            border-color: #c0392b;
            outline: none;
        }

        @media screen and (max-width: 768px) {
            th, td {
                padding: 10px;
            }
        }

.modal {
            display: none;
            position: fixed;
            top: 0;
            left: 50%;
            transform: translateX(-50%);
            background: rgba(255, 255, 255, 0.9);
            padding: 20px;
            border: 2px solid black;
            z-index: 20;
            text-align: center;
            width: 300px;
            animation:  fadeIn 0.5s, fadeOut 1s 2s forwards;
}
@keyframes shake {
        0% { transform: translate(-50%, -50%) translateX(0); }
        25% { transform: translate(-50%, -50%) translateX(-10px); }
        50% { transform: translate(-50%, -50%) translateX(10px); }
        75% { transform: translate(-50%, -50%) translateX(-10px); }
        100% { transform: translate(-50%, -50%) translateX(0); }
    }

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

#easterEggModal  {
    animation: fadeIn 0.5s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.popup {
    display: none;
    position: fixed;
    z-index: 1;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.9);
    padding: 20px;
    border: 2px solid black;
    text-align: center;
    width: 300px;
}

.qrcode {
    width: 100%;
    height: auto;
}

.popup button {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
}

.player {
    margin-top: 10px;
    height: 300px;
    width: 400px;
    background-color: rgba(216, 218, 221, 0.5);
    border-radius: 10px;
}


        .cover {
    height: 200px;
    width: 400px;
    margin-left: 20px;
    margin-top: 15px;
    overflow: hidden;
    border-radius: 10px;
    display: flex;
    /* 水平方向布局，两端对齐 */
    justify-content: flex-start;
    /* 垂直方向居中对齐 */
    align-items: stretch;
}

.right-sidebar audio {
    width: 100%;
    height: 30px; /* 适当调整高度，可根据实际情况修改 */
    border-radius: 10px;
}
.song {
         margin-bottom: 50px;
    margin-left: 10px;
    font-family: "楷体" ;
}
.player h2{
    font-family: "楷体";
    margin: 10px;
    margin-left: 50px;
}

.music-back {
    width: 200px;
    height: auto;
    border-radius: 50%;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}
audio {
    width: 100%; /* 宽度为100% */
    height: 50px; /* 高度为50px */
    border-radius: 10px; /* 边框半径为10px */
}

/* 设置音频播放进度条的颜色 */
audio::-webkit-media-controls-progress-bar {
    background-color: #000;
}

/* 定义播放器的背景颜色 */
.player {
    /* background: linear-gradient(to bottom, #304352, #d7d2cc); */
    background-color: rgba(238, 238, 238, 0.2); /* 背景颜色为rgba(238, 238, 238, 0.2) */
}

/* 隐藏音频播放器的背景颜色 */
audio::-webkit-media-controls-enclosure {
    background-color: rgba(216, 218, 221, 0.0);
}
 @keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}
.music-back.rotating {
    animation: rotate 2s linear infinite;
}
.left-sidebar {
    position: relative;
    /* 假设.left-sidebar有背景图，这里设置背景图相关属性，可根据实际情况调整 */
    background: url('../static/left-bg.jpg') no-repeat center center;
    background-size: cover;
}

.ai-window {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    width: 100%;
    height: 700px;
    position: relative;
    border: 1px solid #ccc;
    margin-bottom: 20px;
    border-radius: 10px;
    padding: 20px;
    box-sizing: border-box;
    overflow: hidden;
    background: url('img/aibg.jpg') no-repeat center center; /* Add your background image here */
    background-size: cover;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

#chatContainer {
    overflow-y: auto;
    max-height: 90%;
    display: flex;
    flex-direction: column;
    margin-top: auto;
    padding: 10px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 10px;
    box-shadow: inset 0 4px 8px rgba(0, 0, 0, 0.1);
}

.sent-message, .reply-message {
    width: fit-content;
    max-width: 80%;
    padding: 10px 15px;
    margin: 5px 0;
    border-radius: 20px;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.sent-message {
    align-self: flex-end;
    background-color: #c0392b;
    color: #fff;
}

.reply-message {
    align-self: flex-start;
    background-color: #ecf0f1;
    color: #333;
}

#userInput {
    width: calc(100% - 40px);
    padding: 10px;
    margin-top: 10px;
    border: 1px solid #ccc;
    border-radius: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    font-size: 16px;
}
.button-container {
    position: relative;
    z-index: 10; /* 保持按钮容器较高的层级 */
    text-align: center; /* 使按钮在水平方向居中 */
    margin-bottom: -10px;
    margin-top: -20px;

}
.clickable-image {
    display: inline-block;
    cursor: pointer;
    transition: transform 0.3s;
}

.clickable-image:hover {
    transform: scale(1.1); /* Slightly enlarge the image on hover */
}


@keyframes fadeIn {
    from {
        opacity: 0; /* 初始透明度为0，完全透明 */
    }
    to {
        opacity: 1; /* 最终透明度为1，完全显示 */
    }
}
img {
            cursor: pointer;
            width: 80px;
            height: auto;
            border-radius: 5px;
            transition: transform 0.2s;
        }

        img:hover {
            transform: scale(1.1);
        }
.calendar-container {
    margin-top: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
}

#calendar {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
    width: 100%;
    max-width: 400px;
    background-color: #fff;
    padding: 10px;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.calendar-day {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px;
    border-radius: 5px;
    font-weight: bold;
    cursor: pointer;
    position: relative; /* Add this line */
}
.calendar-day.today {
    background-color: #77fffa;
}

.calendar-day.marked {
    background-color: #fa8377;
    color: #fff;
}

.calendar-container button {
    background-color: #c0392b;
    color: white;
    border: none;
    padding: 10px 20px;
    font-size: 14px;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
    margin: 0 10px;
}

.calendar-container button:hover {
    background-color: #a93226;
}
.stamp {
    position: absolute;
    width: 30px;
    height: 30px;
    bottom: 5px;
    right: 5px;
    animation: stampAnimation 1s forwards;
}

@keyframes stampAnimation {
    0% {
        transform: scale(0) rotate(0deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.2) rotate(20deg);
        opacity: 1;
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}
.small-stamp {
   position: absolute;
    width: 20px;
    height: 20px;
    bottom: 0;
    right: -3px;
    z-index: 10;
}
    </style>
</head>
<body>

   <div class="navbar">
            <div class="logo-container">
                <img src="img/logo.png" alt="Logo">
                <span>福卫兵</span>
            </div>
            <a href="#">主页</a>
            <div class="dropdown">
                <a href="#" class="dropbtn">菜单</a>
                <div class="dropdown-content">
                    <a href="index.html">图片分析</a>
                    <a href="comment_analyse.html">贴吧评论分析</a>
                    <a href="analyse_demo.html">微博评论分析</a>
                </div>
            </div>

<a id="aboutButton">关于我们</a>
    <a id="contactButton">联系</a>
</div>
<div id="aboutModal" class="modal">
        <p>大数据福卫兵兵团感谢你的喜欢</p>
</div>

<div id="easterEggModal" class="modal">
        <p>维护福大网络环境 人人有责 快来加入福卫兵吧</p>
</div>

<div id="contactModal" class="popup">
    <img src="img/qrcode.png" alt="QR Code" class="qrcode">
    <button onclick="closeContactModal()">×</button>
</div>

    <header>
        <h1>恭喜成为福小兵</h1>
        <h1>评论情感分析</h1>
    </header>

    <main>
        <!-- 更新柱形图的 canvas 元素 -->
        <div class="chart-container">
            <canvas id="emotionChart"></canvas>
        </div>
<div class="left-sidebar">
    <div class="ai-window">
    <div id="chatContainer"></div>
    <input type="text" id="userInput" placeholder="福兵，开启今日的巡查吧！">
</div>
<div class="button-container">
    <img src="img/fu.png" alt="Clickable Image" class="clickable-image" onclick="sendText()">
</div>


</div>


    <div class="right-sidebar">
        <!-- 音乐播放器 -->
        <div class="player">
            <!-- 歌曲封面 -->
            <div class="cover">
                <img src="music/back.jpg" alt="" class="music-back">
                <div class="song">
                    <p>
                    纯音乐,请欣赏<br>
                    </p>
                </div>
            </div>
            <!-- 歌词设置 -->
            <h2>清澈的眼睛</h2>
            <!-- audio标签 -->
            <div class="mus">
                <audio src="music/bgm.mp3" controls autoplay loop></audio>
            </div>
        </div>
		<div class="calendar-container">
		    <div id="calendar"></div>
		</div>
    </div>
        <table>
            <thead>
                <tr>
                    <th>序号</th>
                    <th>评论</th>
                    <th>情感分析</th>
                    <th>分数</th>
                </tr>
            </thead>
            <tbody id="commentsTableBody"></tbody>
        </table>

        <div class="pagination">
            <button id="prevPage" disabled>上一页</button>
            <span id="pageInfo"></span>
            <button id="nextPage">下一页</button>
            <input type="number" id="jumpToPage" min="1" placeholder="页码">
            <button id="jumpPageButton">跳转</button>
        </div>
    </main>

    <script>
        const itemsPerPage = 10; // 每页显示10条
        let currentPage = 1;
        let sentimentData = [];
        // 加载并渲染评论情感数据
        async function loadComments() {
            try {
                console.log("开始加载评论分析数据");
                // 从后端 API 获取数据
                const response = await fetch('http://localhost:5000/api/comments2');
                if (!response.ok) {
                    throw new Error(`HTTP 错误! 状态: ${response.status}`);
                }
                const result = await response.json();
                console.log("获取到的评论分析结果:", result);
                sentimentData = result.comments;

                renderTable(currentPage);
                renderSentimentChart(sentimentData);
            } catch (error) {
                console.error('无法加载评论分析数据:', error);
            }
        }

        // 渲染表格数据
        function renderTable(page) {
            const tableBody = document.getElementById('commentsTableBody');
            tableBody.innerHTML = ''; // 清空表格

            const startIndex = (page - 1) * itemsPerPage;
            const endIndex = Math.min(startIndex + itemsPerPage, sentimentData.length);
            const pageData = sentimentData.slice(startIndex, endIndex);

            pageData.forEach((comment, index) => {
                const tr = document.createElement('tr');

                // 添加序号单元格
                const tdIndex = document.createElement('td');
                tdIndex.textContent = startIndex + index + 1;
                tr.appendChild(tdIndex);

                // 添加文本单元格
                const tdText = document.createElement('td');
                tdText.textContent = comment.text;
                tr.appendChild(tdText);

                // 添加情感单元格
                const tdSentiment = document.createElement('td');
                tdSentiment.textContent = comment.sentiment;
                tr.appendChild(tdSentiment);

                // 添加分数单元格
                const tdScore = document.createElement('td');
                tdScore.textContent = comment.score;
                tr.appendChild(tdScore);

                tableBody.appendChild(tr);
            });

            updatePaginationInfo(page, sentimentData.length);
        }

        // 更新分页信息
        function updatePaginationInfo(page, totalItems) {
            const totalPages = Math.ceil(totalItems / itemsPerPage);
            document.getElementById('pageInfo').textContent = `第 ${page} 页，共 ${totalPages} 页`;
            document.getElementById('prevPage').disabled = page === 1;
            document.getElementById('nextPage').disabled = page === totalPages;
        }

        // 分页按钮事件
        document.getElementById('prevPage').onclick = function () {
            if (currentPage > 1) {
                currentPage--;
                renderTable(currentPage);
            }
        };

        document.getElementById('nextPage').onclick = function () {
            const totalPages = Math.ceil(sentimentData.length / itemsPerPage);
            if (currentPage < totalPages) {
                currentPage++;
                renderTable(currentPage);
            }
        };

        document.getElementById('jumpPageButton').onclick = function () {
            const jumpPage = parseInt(document.getElementById('jumpToPage').value);
            const totalPages = Math.ceil(sentimentData.length / itemsPerPage);
            if (!isNaN(jumpPage) && jumpPage >= 1 && jumpPage <= totalPages) {
                currentPage = jumpPage;
                renderTable(currentPage);
            } else {
                alert('请输入有效的页码');
            }
        };

        // 渲染情感分布图表
        function renderSentimentChart(comments) {
            const sentimentCounts = {};

            comments.forEach(comment => {
                if (sentimentCounts.hasOwnProperty(comment.sentiment)) {
                    sentimentCounts[comment.sentiment]++;
                } else {
                    sentimentCounts[comment.sentiment] = 1;
                }
            });

            const ctx = document.getElementById('emotionChart').getContext('2d');
            // 销毁旧图表（如果存在）
            if (window.emotionChartInstance) {
                window.emotionChartInstance.destroy();
            }

            window.emotionChartInstance = new Chart(ctx, {
                    type: 'bar',
                    data: {
                        labels: Object.keys(sentimentCounts),
                        datasets: [{
                            label: '情感总结',
                            data: Object.values(sentimentCounts),
                            
                            backgroundColor: [
                            '#c0392b',
                            '#3498db', // 悲伤
                            '#9b59b6', // 惊讶
                            '#95a5a6'
                            ],        // 与 index.html 一致的颜色
                            borderWidth: 1
                        }]
                    },
                    options: {
                        responsive: true,
                        plugins: {
                            legend: {
                                display: false
                            },
                            tooltip: {
                                enabled: true
                            },
                            datalabels: {
                                anchor: 'end',
                                align: 'top',
                                offset: -10,
                                color: '#333',
                                font: {
                                    size: 14,
                                    weight: 'bold'
                                },
                                formatter: function(value) {
                                    return value;
                                }
                            }
                        },
                        scales: {
                            x: {
                                title: {
                                    display: true,
                                    text: '情感类型'
                                },
                                grid: {
                                    display: false // 删除 x 轴背景方格线
                                }
                            },
                            y: {
                                beginAtZero: true,
                                title: {
                                    display: true,
                                    text: '数量'
                                },
                                ticks: {
                                    stepSize: 1
                                },
                                grid: {
                                    display: false // 删除 y 轴背景方格线
                                }
                            }
                        }
                    },
                    plugins: [ChartDataLabels]
                });
        }

        // 页面加载完成后调用函数
        document.addEventListener('DOMContentLoaded', loadComments);





		document.addEventListener('DOMContentLoaded', function () {
		    const calendar = document.getElementById('calendar');
		    const today = new Date();
		    const year = today.getFullYear();
		    const month = today.getMonth();
		    const date = today.getDate();
		    let isStamped = false; // Flag to track if the stamp has been applied

		    function generateCalendar(year, month) {
		        calendar.innerHTML = '';
		        const firstDay = new Date(year, month, 1).getDay();
		        const daysInMonth = new Date(year, month + 1, 0).getDate();

		        for (let i = 0; i < firstDay; i++) {
		            const emptyCell = document.createElement('div');
		            calendar.appendChild(emptyCell);
		        }

		        for (let day = 1; day <= daysInMonth; day++) {
		            const dayCell = document.createElement('div');
		            dayCell.textContent = day;
		            dayCell.classList.add('calendar-day');
		            if (day === date) {
		                dayCell.classList.add('today');
		            }
		            calendar.appendChild(dayCell);
		        }
		    }

		    generateCalendar(year, month);

		    const clickableImage = document.querySelector('.clickable-image');
		    clickableImage.addEventListener('click', function () {
		        if (!isStamped) { // Check if the stamp has already been applied
		            const todayCell = document.querySelector('.calendar-day.today');
		            if (todayCell) {
		                const stamp = document.createElement('img');
		                stamp.src = 'img/fu.png';
		                stamp.classList.add('stamp');
		                todayCell.appendChild(stamp);

		                setTimeout(() => {
		                    todayCell.classList.add('marked');
		                    stamp.remove();

		                    const smallImage = document.createElement('img');
		                    smallImage.src = 'img/fu.png'; // Path to the small image
		                    smallImage.classList.add('small-stamp');
		                    todayCell.appendChild(smallImage);
		                }, 1000); // Adjust the timeout duration as needed

		                isStamped = true; // Set the flag to true after stamping
		            }
		        }
		    });
		});
		function handleKeyPress(event) {
            if (event.key === 'Enter') {
                sendText();
            }
        }
        function sendText() {
            const userInput = document.getElementById('userInput').value.trim();
            const chatContainer = document.getElementById('chatContainer');
        
            if (userInput !== '') {
                // 显示用户发送的消息
                const userMessage = document.createElement('div');
                userMessage.textContent = userInput;
                userMessage.classList.add('sent-message');
                chatContainer.appendChild(userMessage);
        
                // 清空输入框
                document.getElementById('userInput').value = '';
        
                // 滚动到聊天底部
                chatContainer.scrollTop = chatContainer.scrollHeight;
        
                // 发送请求到后端处理
                fetch('http://localhost:5000/api/chat', { // 请根据实际后端地址修改
                    method: 'POST',
                    headers: {
                        'Content-Type': 'application/json'
                    },
                    body: JSON.stringify({ message: userInput })
                })
                .then(response => response.json())
                .then(data => {
                    // 显示 AI 助手的回复
                    const aiMessage = document.createElement('div');
                    aiMessage.textContent = data.reply; // 假设后端返回 { reply: "回复内容" }
                    aiMessage.classList.add('reply-message');
                    chatContainer.appendChild(aiMessage);
        
                    // 滚动到聊天底部
                    chatContainer.scrollTop = chatContainer.scrollHeight;
                })
                .catch(error => {
                    console.error('Error:', error);
                    const errorMessage = document.createElement('div');
                    errorMessage.textContent = '抱歉，出现了一个错误。请稍后再试。';
                    errorMessage.classList.add('reply-message');
                    chatContainer.appendChild(errorMessage);
                    chatContainer.scrollTop = chatContainer.scrollHeight;
                });
            }
        }
        function showMessage() {
            $('#message').show();
            $('#message').css('animation-play-state', 'running'); // 触发动画开始播放
        
        }
         document.addEventListener('DOMContentLoaded', function () {
    const audio = document.querySelector('audio');
    const musicImg = document.querySelector('.music-img');

    function toggleRotation() {
        if (audio.paused) {
            musicImg.classList.remove('rotating');
        } else {
            musicImg.classList.add('rotating');
        }
    }

    audio.addEventListener('play', toggleRotation);
    audio.addEventListener('pause', toggleRotation);
    audio.addEventListener('ended', toggleRotation);

    // Start rotation if audio is already playing (autoplay)
    if (!audio.paused) {
        musicImg.classList.add('rotating');
    }
});
		document.addEventListener('DOMContentLoaded', function () {
    let aboutClickCount = 0;

    const aboutModal = document.getElementById('aboutModal');
    const easterEggModal = document.getElementById('easterEggModal');
    const contactModal = document.getElementById('contactModal');

    const aboutButton = document.getElementById('aboutButton');
    const contactButton = document.getElementById('contactButton');

    aboutButton.addEventListener('click', function () {
        aboutClickCount++;
        aboutModal.style.display = 'block';
        setTimeout(function () {
            aboutModal.style.display = 'none';
        }, 5000); // 5 seconds total (0.5s fade in + 2s fade out + 2.5s display time)

        if (aboutClickCount % 10 === 0) {
            easterEggModal.style.display = 'block';
            setTimeout(function () {
                easterEggModal.style.display = 'none';
            }, 5000); // 5 seconds display time
        }
    });

    contactButton.addEventListener('click', function () {
        contactModal.style.display = 'block';
        setTimeout(function () {
            contactModal.style.display = 'none';
        }, 5000); // 5 seconds display time
    });

    window.addEventListener('click', function (event) {
        if (event.target === aboutModal) {
            aboutModal.style.display = 'none';
        }
        if (event.target === easterEggModal) {
            easterEggModal.style.display = 'none';
        }
        if (event.target === contactModal) {
            contactModal.style.display = 'none';
        }
    });
});

		
    </script>
</body>
</html>